package top.kangyaocoding.ltzf.payment.jumph5.model;

import lombok.Getter;
import lombok.Setter;
import top.kangyaocoding.ltzf.utils.SignUtils;

import java.util.HashMap;

/**
 * @Author K·Herbert
 * @Description 查询请求信息
 * @Date 2024-05-14 19:22
 */

@Getter
public class QueryOrderByOutTradeNoRequest {
    /*商户号*/
    @Setter
    private String mchId;
    /*商户订单号*/
    @Setter
    private String outTradeNo;
    /*当前时间戳*/
    private final String timestamp = String.valueOf(System.currentTimeMillis() / 1000);

    /*创建签名*/
    public String createSign(String key) {
        HashMap<String, String> dataMap = new HashMap<>();
        dataMap.put("mch_id", getMchId());
        dataMap.put("out_trade_no", getOutTradeNo());
        dataMap.put("timestamp", getTimestamp());

        return SignUtils.createSign(dataMap, key);
    }
}
